package com.joymart.order.model;

import com.joymart.common.abstraction.StatusHolder;
import lombok.Data;
import lombok.Getter;
import org.springframework.data.annotation.Id;

import java.math.BigDecimal;
import java.time.LocalDateTime;

@Data
public class Order implements StatusHolder<Order.Status> {

    @Id
    private String id;
    private Status status;
    private String productId;
    private Integer quantity;
    private BigDecimal unitPrice;
    private BigDecimal unitPv;
    private BigDecimal totalPrice;
    private BigDecimal totalPv;
    private String buyerId;
    private String firstSellerId;
    private BigDecimal firstSellerProfit;
    private String secondSellerId;
    private BigDecimal secondSellerProfit;
    private String receiverDistrict;
    private String receiverName;
    private String receiverPhone;
    private String deliveryVendorId;
    private String deliveryNo;
    private String receiverAddress;
    private String remark;
    //买家 提醒过 经营店铺 确认收款
    private boolean firstSellerInformed;
    // 经营店铺 提醒过 管理店铺 确认收款
    private boolean secondSellerInformed;
    private LocalDateTime createdAt;

    public enum Status {
        CREATED("已创建","订单已创建"),
        BUYER_PAID("买家已付款","已付款"),
        FIRST_SELLER_PAID("经营店铺已付款","等待发货"),
        SECOND_SELLER_PAID("管理店铺已付款","等待发货"),
        DELIVERING("总部已发货，物流运输中","运输中"),
        RECEIVED("买家确认收货","订单完成"),
        CANCELLED("已取消","已取消"),
        ;
        @Getter
        private String description;
        @Getter
        private String brief;

        Status(String description, String brief) {
            this.description = description;
            this.brief = brief;
        }
    }
}
